package org.crazyit.activiti_d3._4_DeleteUser;

import org.activiti.engine.IdentityService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.crazyit.activiti_d3._3_UpdateUser.UpdateUser;

import java.util.UUID;

public class DeleteUser {

    public static void main(String[] args) {

        //1. 创建流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

        //2. 得到身份服务组件实例
        IdentityService identityService = engine.getIdentityService();

        //3. 创建用户
        String id = UUID.randomUUID().toString();
        UpdateUser.createUser(identityService, id,"angus","young","yangenxiong@163.com","abc");
        System.out.println("删除前数量:" + identityService.createUserQuery().userId(id).count());

        //4. 删除用户
        identityService.deleteUser(id);
        System.out.println("删除后数量:" + identityService.createUserQuery().userId(id).count());

    }

}
